#include "PrintSetting.h"

const CString strPrintSetting = L"PtintSetting";

PrintSetting::PrintSetting() :
	m_nRows(1),
	m_nCols(1),
	m_dMarginTop(1.5),
	m_dMarginBottom(1.5),
	m_dMarginLeft(1.5),
	m_dMarginRight(1.5),
	m_bPrintPage(FALSE),
	m_nStartPage(1),
	m_bPrintHeader(FALSE),
	m_bPrintFooter(FALSE)
{
	memset(m_strHeader, 0, sizeof(m_strHeader));
	memset(m_strFooter, 0, sizeof(m_strFooter));
}

PrintSetting::~PrintSetting()
{
}

void PrintSetting::Init()
{
	m_nRows = 1;
	m_nCols = 1;
	m_dMarginTop = 1.5;
	m_dMarginBottom = 1.5;
	m_dMarginLeft = 1.5;
	m_dMarginRight = 1.5;
	m_bPrintPage = FALSE;
	m_nStartPage = 1;
	m_bPrintHeader = FALSE;
	memset(m_strHeader, 0, sizeof(m_strHeader));
	m_bPrintFooter = FALSE;
	memset(m_strFooter, 0, sizeof(m_strFooter));
}

void PrintSetting::LoadSetting(CString strFileName)
{
#ifdef _DEBUG
	int m = sizeof(PrintSetting);
#endif // _DEBUG

	if (GetPrivateProfileStruct(strPrintSetting, L"PrintInfo", this, sizeof(PrintSetting), strFileName))
	{
		ASSERT(m_nRows > 0);
	}
}

void PrintSetting::SaveSetting(CString strFileName)
{
	ASSERT(WritePrivateProfileStruct(strPrintSetting, L"PrintInfo", this, sizeof(PrintSetting), strFileName));
}
